{extend name="../template/admin/base.html" /}
{block name="index_right"}
<ul class="nav nav-tabs" role="tablist">
    <li class="active"><a href="{:url('admin/goods/index')}">商品列表</a></li>
    <li><a href="{:url('admin/goods/post')}">商品添加</a></li>
</ul>
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">栏目管理</h3>
    </div>
    <div class="panel-body">
        <table class="table table-hover">
            <thead>
            <tr>
                <th width="5%">编号</th>
                <th>商品名称</th>
                <th>价格</th>
                <th>列表图</th>
                <th>所属栏目</th>
                <th>库存</th>
                <th width="20%">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="goods" id="vo"}
            <tr>
                <th>{$vo.de_id}</th>
                <th>{$vo.de_name}</th>
                <th>{$vo.now_price}</th>
                <td>
                    <img src="{$vo['shop_thumb']}" width="50" alt="">
                </td>
                <th>{$vo.pid}</th>
                <th>{$vo.stock}</th>
                <td>
                <div class="btn-group btn-group-sm">
                    <a href="{:url('admin/goods/post',['de_id'=>$vo.de_id])}" class="btn btn-success">编辑</a>
                    <a href="javascript:;" onclick="del({$vo['de_id']})" class="btn btn-primary">下架</a>
                </div>
            </td>
            </tr>
            {/volist}
            </tbody>
        </table>
        {$goods->render()}

    </div>
</div>

<script>
    function del(de_id) {
        require(['util'],function (util) {
            util.confirm('确定将该商品下架吗?',function(){
                location.href="{:url('down')}&de_id=" + de_id;
            })
        })
    }
</script>
{/block}